package org.icosagon.core.character.traits;

import org.icosagon.core.Modifiable;

/**
 * The ability score is what determines what many of the other statistics will
 * be. The ability score has a name such as "strength" or "intelligence" and a
 * value to associate it with.
 * @author Daniel Owens
 */
public class Ability implements Modifiable {
    public static final String STRENGTH = "STRENGTH";
    public static final String CONSTITUTION = "CONSTITUTION";
    public static final String DEXTERITY = "DEXTERITY";
    public static final String INTELLIGENCE = "INTELLIGENCE";
    public static final String WISDOM ="WISDOM";
    public static final String CHARISMA = "CHARISMA";

    private String ability = null;
    private int value = 0;
    
    Ability(String arg) {
        this.ability = arg;
    }
    
    public String getName() {
        return this.ability;
    }
    
    public void setValue(int val) {
        this.value = val;
    }
    
    public int getValue() {
        return this.value;
    }

    public int getModifier() {
        return (this.value-10)/2;
    }

    /**
     * Compares the abilities to see if they match. The case of the ability name does
     * not matter.
     * @param value Camparing Ability
     * @return true - if the name and value are the same.
     */
    public boolean equals(Ability value) {
        if(this.ability.toLowerCase().equals(value.getName().toLowerCase() )  &&  (value.getValue() == this.value))
            return true;
        return false;
    }
}